package org.kwin.tomcat.servlet.http;

import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.http.HttpRequest;
import org.kwin.tomcat.servlet.ServletResponse;

import java.io.IOException;
import java.io.PrintWriter;

/**
 * @author : wangkai
 * @version V1.0
 * @Package org.kwin.tomcat.servlet.http
 * @Description:
 * @date 2021年10月12日 9:27
 **/
public class HttpServletResponse implements ServletResponse {
    
    private ChannelHandlerContext ctx;
    private HttpRequest req;
    private ServletOutputStream writer;
    
    private String contentType = "text/html;";
    
    public HttpServletResponse(ChannelHandlerContext ctx, HttpRequest req) {
        this.ctx = ctx;
        this.req = req;
        this.writer = new ServletOutputStream(this);
    }
    
    public ChannelHandlerContext getCtx() {
        return ctx;
    }
    
    @Override
    public void setContentType(String var1) {
        this.contentType = var1;
    }
    
    @Override
    public String getContentType() {
        return contentType;
    }
    
    @Override
    public ServletOutputStream getWriter() throws IOException {
        return writer;
    }
    
}
